feat(wireguard): manage WireGuard peers via Xray's inbound UserManager#64
Open
bitwiresys wants to merge 1 commit into
Open
feat(wireguard): manage WireGuard peers via Xray's inbound UserManager#64bitwiresys wants to merge 1 commit into
bitwiresys wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds a WireGuard backend path that provisions/removes peers on Xray's
WireGuard inbound through the UserManager gRPC API (AddUser/RemoveUser),
so WG users can be managed at runtime without restarting the core —
mirroring how the other Xray inbounds are handled.
- backend/xray/api/wireguard_account.go: WireGuard account -> PeerConfig
- backend/xray/api/wireguard_key.go: base64<->hex key helpers
- backend/xray/wireguard_sync.go: push/sync WG peers via UserManager
- backend/xray/{config,user,xray}.go, api/account.go: wire WG into the
inbound/user flow
- common/service.proto (+ regenerated service.pb.go): add Wireguard
pre_shared_key field so PSK can be delivered to the node
- bump xtls/xray-core to a revision that ships the WG inbound UserManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a WireGuard path on the Xray backend that provisions and removes peers on Xray's WireGuard inbound through its UserManager gRPC API (
AlterInbound→AddUser/RemoveUser), so WG users can be added/removed at runtime without restarting the core — exactly like every other Xray inbound the node already manages. It does not touch the existing nativebackend/wireguard/backend; it is purely additive.Why
Xray gained a first-class WireGuard inbound with a UserManager in XTLS/Xray-core#6360 (merged, shipping in v26.6.27). With that, WireGuard can be served through the same Xray process as all other protocols:
user>>>…>>>trafficstats like the rest.How
backend/xray/api/wireguard_account.go— maps a user's WG proxy settings to an Xraywireguard.PeerConfigaccount forAddUser.backend/xray/api/wireguard_key.go— base64⇄hex key helpers (Xray IPC expects hex).backend/xray/wireguard_sync.go— push/diff WG peers via the UserManager without restarting Xray.backend/xray/{config,user,xray}.go,api/account.go— wire the WG account into the existing inbound/user/sync flow.common/service.proto(+ regeneratedservice.pb.go) — addWireguard.pre_shared_keyso an optional PSK reaches the node.go.mod— bumpxtls/xray-coreto the revision that ships the WG inbound UserManager (v26.6.27).Compatibility / notes
godirective stays 1.26.3 (already current ondev); the xray-core bump pulls the WG UserManager API.v26.x(not Go-module-resolvable on the bare module path); happy to repin to a clean tag once one is published.Testing
go build ./...,go vet ./...clean.make testpasses the same set asdev(the*WithRealXray/ controller API-key tests need the CI's xray binary +API_KEY, and fail identically on a bare checkout ofdev).